/*This module contains all api funcs*/

import ajax from './ajax'
const BASE = '/api'

// export const reqPosition = ()=>ajax('http://api.map.baidu.com/api?v=2.0&ak=UYCvoihV25xWhdC1exlGaHQz2GLW5Ijm')

export const reqAddress = (longitude,latitude)=>ajax(BASE+`/position/${latitude},${longitude}`)

export const reqGoodCategories = ()=>ajax(BASE+'/index_category')

export const reqShopList = ({longitude,latitude})=>ajax(BASE+'/shops',{longitude,latitude})

export const reqSms = (phone) => ajax(BASE+'/sendcode',{phone})

export const loginbySms = ({phone,code})=>ajax(BASE+'/login_sms',{phone,code},'POST')

export const loginbyPwd = ({name,pwd,captcha}) => ajax(BASE+'/login_pwd', {name,pwd,captcha},'POST')

export const reqUserbySession = () => ajax(BASE + '/userinfo')

export const reqLogout = () => ajax(BASE + '/logout')

export const reqGoods = ()=> ajax('/goods')
export const reqRatings = ()=> ajax('/ratings')
export const reqInfo = ()=> ajax('/info')
